#include "QtTileManager.h"

QtTileManager::QtTileManager()
{
}

QtTileManager::~QtTileManager()
{
}

QPixmap QtTileManager::RobotTile(const std::string& robottype) const
{	
	QPixmap tile( QString::fromStdString("robots/"+robottype) );

	if (tile.isNull())
		throw "QtTileManager: Could not find robot tile";
	

	return tile;
}

QPixmap QtTileManager::CellTile(const std::string& celltype) const
{	
	QPixmap tile( QString::fromStdString("cells/"+celltype) );

	if (tile.isNull())
		throw "QtTileManager: Could not find cell tile";
	

	return tile;
}

QPixmap QtTileManager::Tile(const Resourceable& resourceable, const std::string& resourceId) const
{	
	std::string resourceString = "resources/"+resourceable.Resource(resourceId)+".png";

	printf("Loading resource %s\n", resourceString.c_str());
	QPixmap tile( QString::fromStdString(resourceString) );

	if (tile.isNull())
		throw "QtTileManager: Could not find tile";
	

	return tile;
}

